namespace OneToManyEntityFramework.Migrations
{
    using OneToManyEntityFramework.Model;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<OneToManyEntityFramework.Models.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(OneToManyEntityFramework.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
            context.Albums.AddOrUpdate( //what is the difference between the two if ur making a seed method of new album data?
                p => p.AlbumId,
                new Album { AlbumId = 1, Name = "If You're Reading This It's Too Late", Artist = "Drake", DateCreated = DateTime.Now },
                new Album { AlbumId = 2, Name = "Graduation", Artist = "Kanye West", DateCreated = DateTime.Now },
                new Album { AlbumId = 3, Name = "T.P.A.B", Artist = "Kendrick Lamar", DateCreated = DateTime.Now }
            );
            context.Songs.AddOrUpdate(
                p => p.SongId,
                new Song { AlbumId = 1, SongId = 1, DateReleased = new DateTime(2014, 02, 12), Title = "6 Man", DateCreated = DateTime.Now },
                new Song { AlbumId = 1, SongId = 2, DateReleased = new DateTime(2013, 05, 12), Title = "0 to 100", DateCreated = DateTime.Now },
                new Song { AlbumId = 2, SongId = 3, DateReleased = new DateTime(2008, 03, 23), Title = "Good Morning", DateCreated = DateTime.Now },
                new Song { AlbumId = 2, SongId = 4, DateReleased = new DateTime(2008, 03, 23), Title = "Stronger", DateCreated = DateTime.Now },
                new Song { AlbumId = 3, SongId = 5, DateReleased = new DateTime(2012, 05, 27), Title = "Compton", DateCreated = DateTime.Now },
                new Song { AlbumId = 3, SongId = 6, DateReleased = new DateTime(2012, 05, 23), Title = "Real", DateCreated = DateTime.Now }
            );
        }
    }
}